package addon.w3.mdx.com;

import java.io.IOException;

import addon.w3.mdx.MDXCOM;
import addon.w3.mdx.LEDataInputStream;
import addon.w3.mdx.MDXException;

/**
 * struct {
		ASCII	Name;			(0x50 bytes)
		long	IntStart, IntEnd;
		float	MoveSpeed;
		long	NoLooping;		(0:loop; 1:no loop)
		float	Rarity;
		long	???;			(0)
		float	BoundsRadius;
		float	MinExtx, MinExty, MinExtz;
		float	MaxExtx, MaxExty, MaxExtz;
	} sequences[nseqs];
 * @author madjk
 *
 */
public class MDXSequenceCOM extends MDXCOM {
	public String name = null;
	public int intStart, intEnd;
	public float moveSpeed;
	public int noLooping;
	public float rarity;
	public int chunk1;
	public float boundRadius;
	public float minExt[];
	public float maxExt[];
	
	public String getTag() {
		return "SEQS:COM";
	}
	
	public void _decode(LEDataInputStream ins) throws IOException, MDXException {
		byte nameBytes[] = new byte[80];
		ins.read(nameBytes);
		name = new String(nameBytes);
		intStart = ins.readInt();
		intEnd = ins.readInt();
		moveSpeed = ins.readFloat();
		noLooping = ins.readInt();
		rarity = ins.readFloat();
		chunk1 = ins.readInt();
		boundRadius = ins.readFloat();
		minExt = new float[3];
		minExt[0] = ins.readFloat();
		minExt[1] = ins.readFloat();
		minExt[2] = ins.readFloat();
		maxExt = new float[3];
		maxExt[0] = ins.readFloat();
		maxExt[1] = ins.readFloat();
		maxExt[2] = ins.readFloat();
	}
	
	public String toString() {
		StringBuffer sb = new StringBuffer();
		sb.append("TAG : "+getTag());
		sb.append("\n\tNAME : "+name);
		sb.append("\n\tintStart,intEnd : "+intStart+", "+intEnd);
		sb.append("\n\tMOVESPEED : "+moveSpeed);
		sb.append("\n\tNOLOOPING : "+noLooping);
		sb.append("\n\tRARITY : "+rarity);
		sb.append("\n\tCHUNK_1 : "+chunk1);
		sb.append("\n\tBOUNDRADIUS : "+boundRadius);
		sb.append("\n\tminExt[3] : "+minExt[0]+" : "+minExt[1]+" : "+minExt[2]);
		sb.append("\n\tmaxExt[3] : "+maxExt[0]+" : "+maxExt[1]+" : "+maxExt[2]);
		return sb.toString();
	}

	@Override
	public boolean isImplicitTag() {
		// TODO Auto-generated method stub
		return false;
	}
}
